package com.ly.other.web;

import com.ly.damai.entity.User;
import com.yc.bean.Result;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("fegin")
public class FeginDemoDo {

    @RequestMapping("add")
    //服务端
    int add(@RequestParam("a") int a,
            @RequestParam("b") int b){
        return a+b;
    }

    @RequestMapping("res")
     Result res(Result result){
        result.setCode(result.getCode() + 1);
          return result;
     }

     @RequestMapping("user")
     User user(@RequestBody User user,
              @RequestParam("myname") String myname){
        user.setUsername(myname);
        return user;
     }

     //请求方式的地址参数
    @RequestMapping("/hello/{na}")
    String hello(@PathVariable("nm") String name){
        return "你好 " + name;
    }
}
